package com.shexianyu.simple;

/**
 * @author shexianyu
 * @desc 876. 链表的中间结点
 * @date 2021/12/4
 */
public class MiddleNode {
    public ListNode middleNode(ListNode head) {
        ListNode[] nodes = new ListNode[100];
        int n = 0;
        while (head != null) {
            nodes[n++] = head;
            head = head.next;
        }
        return nodes[n / 2];
    }
}
